#!/bin/sh

#Two random particles
gnuplot <<EOF
set terminal png size 250,200
set output "plots/particles.png"

set style line 1 lc rgb '#ad1010' lt 1 lw 1.5 pt 5 ps 0.5
set style line 2 lc rgb '#0060ad' lt 1 lw 2.5 pt 5 ps 1

set title " "
set yrange [ -5 : 5 ]
set mxtics 0

set multiplot layout 2,1
set bmargin 0
set format x ""
set ytics -4,2,5
set mytics 0.5
set xlabel ""
set ylabel "Particle Position"
set ylabel offset 0,-2

plot "particle_1.plot" using 1:2 with lines title "x" ls 2, "particle_1.plot" using 1:3 with lines title "y" ls 1

set tmargin 0
set bmargin
set format x "%g"
set key top
set title ""
set xlabel "Iterations"
set ylabel tc rgb "white"
set ylabel offset 0, -10
set ytics -4,2,4 

plot "particle_2.plot" using 1:2 with lines title "x" ls 2, "particle_2.plot" using 1:3 with lines title "y" ls 1

unset multiplot

EOF

#Best solution Map
gnuplot <<EOF
set terminal png
set output "plots/solution.png"

set style line 1 lc rgb '#ad1010' lt 1 lw 2.5 pt 6 ps 0.5

set title "Behaviour of Best Solution"

set xlabel "X"
set ylabel "Y"
set xrange[ -2:2 ]
set yrange[ -2:2 ]

set pm3d map
set palette gray negative

set samples 20

splot x*x+y*y, "solution.plot" using 2:3:(0) with points title "candidate solution" ls 1

EOF

#Alphas
gnuplot <<EOF
set terminal png size 460,340
set output "plots/alphas.png"

set title ""
set xlabel "Alpha 1"
set ylabel "Alpha 2"

set view 39, 106, 1, 1

splot "alphas.plot" w pm3d title ""

EOF

#Alphas Map
gnuplot <<EOF
set terminal png size 460,340
set output "plots/alphas_map.png"

set title ""
set xlabel "Alpha 1"
set ylabel "Alpha 2"

set view 39, 106, 1, 1

set pm3d map

splot "alphas.plot" w pm3d title ""

EOF

#Omegas
gnuplot <<EOF
set terminal png size 460,340
set output "plots/omegas.png"

set style line 1 lc rgb '#0060ad' lt 1 lw 2.5 pt 5 ps 1

set title ""
set xlabel "Bottom Omega"
set ylabel "Meta-Fitness"

set xrange[0.729:0.1]
set yrange[0:22]

plot "omegas.plot" using 2:3 with lines ls 1 title ""

EOF
